package com.jike.shop.cloud.controller;

import com.jike.shop.cloud.IUserService;
import com.jike.shop.cloud.user.dto.Authentication;
import com.jike.shop.cloud.user.dto.LoginReq;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/users")
public class UsersController {
    @DubboReference(group = "jike-shop", version = "1.0.0", protocol = "dubbo")
    private IUserService userService;

    @PostMapping("/login")
    public Authentication login(@RequestBody LoginReq req) {
        return userService.login(req.getUsername(), req.getPassword());
    }
}
